<?php
    Yii::app()->clientScript->registerScriptFile(Yii::app()->request->baseUrl . '/js/sprintf.js');

    $form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array(
        'id' => 'customer-loan-payment-form',
        'enableAjaxValidation' => true,
    ));
?>

<p class="help-block">Fields with <span class="required">*</span> are required.</p>

<?php echo $form->errorSummary($model); ?>

<?php //echo $form->textFieldRow($model,'loansetting_id',array('class'=>'span5')); ?>

<?php //echo $form->textFieldRow($model,'loan_code',array('class'=>'span5','maxlength'=>20)); ?>

<?php //echo $form->textFieldRow($model,'customer_id',array('class'=>'span5')); ?>

<?php //echo $form->textFieldRow($model,'customer_code',array('class'=>'span5','maxlength'=>20)); ?>

<?php echo $form->uneditableRow($model, 'installment_no', array('class' => 'span1')); ?>

<?php echo $form->uneditableRow($model, 'payment', array('class' => 'span1', 'maxlength' => 15)); ?>

<?php echo $form->uneditableRow($model, 'is_last_payment', array('class' => 'span1')); ?>

<?php echo $form->uneditableRow($model, 'pay_on_date', array('class' => 'span2')); ?>

<?php echo $form->textFieldRow($model, 'paid_on_date', array('class' => 'span2', 'value' => date('Y-m-d H:i:s'), 'readonly' => true)); ?>

<?php
    echo $form->textFieldRow($model, 'paid_amount', array('class' => 'span2',
        'maxlength' => 15,
        'onfocus' => 'this.select();',
        'onkeyup' => 'this.value=this.value.replace(/[^\d.]/,\'\')',
        'onblur' => 'this.value=sprintf(\'%.2f\', this.value);',
    ));
?>

<?php echo $form->textAreaRow($model, 'remark', array('class' => 'span5', 'maxlength' => 200)); ?>

<?php //echo $form->textFieldRow($model,'createdate',array('class'=>'span5'));   ?>

<?php echo $form->hiddenRow($model, 'updatedby_user_id'); ?>

<?php //echo $form->textFieldRow($model,'modifydate',array('class'=>'span5'));     ?>

<div class="row-fluid">
    <div class="span2">
        <?php
            $this->widget('bootstrap.widgets.TbButton', array(
                'buttonType' => 'submit',
                'type' => 'primary',
                'label' => t($model->isNewRecord ? 'Create' : 'Save'),
                'icon' => 'icon-ok icon-white',
            ));
        ?>
    </div>
    <div class="span2">
        <?php
            $this->widget('bootstrap.widgets.TbButton', array(
                'buttonType' => 'Button',
                'type' => 'primary',
                'label' => t('Cancel'),
                'url' => Yii::app()->createUrl('customerloanpayment/payment', array('id' => $model->loansetting_id)),
                //'htmlOptions' => array('class' => 'span1'),
                'icon' => 'icon-remove icon-white',
            ));
        ?>
    </div>
</div>
<?php $this->endWidget(); ?>
